<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>爱上电视C1系统</title>
<link rel="stylesheet" href="css/epg_recomm.css">
<link rel="stylesheet" href="css/editPassword.css">
<script src="js/jquery.js"></script>
<script src="js/layer/layer.js"></script>
<script src="js/c1.js"></script>
<script src="laydate/laydate.js"></script>
</head>
<body>
	<div class="header">
		<div class="header_one">
			<p>欢迎您：您当前所在的位置：爱上电视C1系统</p>
		</div>
		<div class="header_two">
			<ul id="tabs_one">
				<li class="tab-nav l"><a href="update.jsp">模板下发</a></li>
				<li class="tab-nav l"><a href="fileDelete.jsp">文件删除</a></li>
				<li class="tab-nav l"><a href="record.jsp?page=1">日志</a></li>

			</ul>
		</div>
	</div>
	<div class="editPassword_main">
		<h2></h2>
		<div class="show">
			<h3>推荐位配置</h3>
			<div class="modify">
				<div class="oldPassword">
					<label for="oldPassword" >平台标识</label><input type="text" id="platform" value="">
				</div>
				<div class="newPassword">
					<label for="newPassword">推荐位唯一标识</label> <input type="text"
						id="poscode" value="">
				</div>
				<div class="confirmPassword">
					<label for="confirmPassword">显示标题</label> <input type="text"
						id="title" value="">

				</div>
				<div class="oldPassword">
					<label for="oldPassword">显示图片：</label> <input type="text" id="icon"
						value="">
				</div>
				<div class="newPassword">
					<label for="newPassword">跳转链接类型</label> <select id="linktype">
						<option value="0">内部链接</option>
						<option value="1">外部应用</option>
						<option value="2">外部链接</option>
					</select>
				</div>
				<div class="confirmPassword">
					<label for="confirmPassword">链接对象类型</label> <select
						id="linkobjtype">
						<option value="vod">电影</option>
						<option value="series">连续剧</option>
						<option value="app">外部应用</option>
						<option value="url">外部链接</option>
						<option value="text">字符串</option>
					</select>

				</div>
				<div class="oldPassword">
					<label for="oldPassword">linkobjvalue</label> <select
						id="linkobjvalue">
						<option value="vod">电影code</option>
						<option value="series">连续剧code</option>
						<option value="app">包路径</option>
						<option value="url">访问链接</option>
					</select>
				</div>
				<div class="newPassword">
					<label for="newPassword">推荐位状态</label> <select id="status">
						<option value="0">失效</option>
						<option value="1">生效</option>
					</select>
				</div>
				<div class="confirmPassword">
					<label for="confirmPassword">生效时间</label> <input type="text"
						id="validtime" value="">

				</div>
				<div class="confirmPassword">
					<label for="confirmPassword">失效时间</label> <input type="text"
						id="expiretime" value="">

				</div>
				<div class="subModify">
					<button class="mdf_psd" value="changePsd" id="mdf_psd">添加</button>
				</div>
			</div>
		</div>
	</div>
	<div class="footer">
		<p>Copyrighto 2015,China IPTV Co.,Ltd.ALLRights Reserved</p>
	</div>
	<script>
		$(function() {
			//日期组件
			laydate({
				elem : '#validtime', //需显示日期的元素选择器
				event : 'click', //触发事件
				format : 'YYYYMMDDhhmmss', //日期格式
				istime : true, //是否开启时间选择
				isclear : true, //是否显示清空
				istoday : true, //是否显示今天
				issure : true, //是否显示确认
				festival : true, //是否显示节日
				choose : function(dates) { //选择好日期的回调
				}
			});
			laydate({
				elem : '#expiretime', //需显示日期的元素选择器
				event : 'click', //触发事件
				format : 'YYYYMMDDhhmmss', //日期格式
				istime : true, //是否开启时间选择
				isclear : true, //是否显示清空
				istoday : true, //是否显示今天
				issure : true, //是否显示确认
				festival : true, //是否显示节日
				choose : function(dates) { //选择好日期的回调
				}
			});
			$('#mdf_psd').on('click', function() {
				var platform = $('#platform').val();
				var poscode = $('#poscode').val();
				var title = $('#title').val();
				var icon = $('#icon').val();
				var linktype = $('#linktype').val();
				var linkobjtype = $('#linkobjtype').val();
				var linkobjvalue = $('#linkobjvalue').val();
				var status = $('#status').val();
				var validtime = $('#validtime').val();
				var expiretime = $('#expiretime').val();
				if (platform == '') {
					alert("平台标识不能为空");
					return;
				}
				if (poscode == '') {
					alert("推荐位唯一标识不能为空");
					return;
				}
				if (title == '') {
					alert("标题不能为空");
					return;
				}
				if (icon == '') {
					alert("图片不能为空");
					return;
				}
				if (linktype == '') {
					alert("跳转链接类型不能为空");
					return;
				}
				if (linkobjtype == '') {
					alert("链接对象类型不能为空");
					return;
				}
				if (linkobjvalue == '') {
					alert("链接对象值不能为空");
					return;
				}
				if (status == '') {
					alert("推荐位状态不能为空");
					return;
				}
				if (validtime == '') {
					alert("推荐位生效时间不能为空");
					return;
				}
				if (expiretime == '') {
					alert("推荐位失效时间不能为空");
					return;
				}
				$.ajax({
					url:'/ApkManager/AddEpgRecommServerlet',
					data:{
						platform:platform,
						poscode:poscode,
						title:title,
						icon:icon,
						linktype:linktype,
						linkobjtype:linkobjtype,
						linkobjvalue:linkobjvalue,
						status:status,
						validtime:validtime,
						expiretime:expiretime
					},
					type:'get',
					success:function(data){
		
						if(data==true){
							layer.alert("成功", {icon: 6,shade: false}, function(index){
								location.href="epgrecomm.jsp";
							});
						}else{
							layer.alert("失败", {icon: 5,shade: false}, function(index){
								location.href="epgrecomm.jsp";
							});
						}
					

					},
					error:function(data){
						layer.alert("失败", {icon: 5,shade: false}, function(index){
							location.href="epgrecomm.jsp";
						});
					}
				})
			});
		})
	</script>
</body>
</html>